//
//  HomeAreaView.m
//  ai2ban
//
//  Created by Luolc on 2018/1/9.
//  Copyright © 2018年 mac book pro. All rights reserved.
//

#import "HomeAreaView.h"

@implementation HomeAreaView

-(instancetype)initWithFrame:(CGRect)frame andIcon:(NSString *)icon andTitle:(NSString *)goodsName andSubTitle:(NSString *)subtitle {
    
    if (self = [super initWithFrame:frame]) {
        
        self.backgroundColor = [UIColor whiteColor];
        
        UIImageView *bg = [[UIImageView alloc] init];
        bg.image = [UIImage imageNamed:icon];
        bg.frame = CGRectMake(0, 0, kScreen_Width, self.height-5);
        [self addSubview:bg];
        
        UIView *centerView = [[UIView alloc] init];
        centerView.backgroundColor = COLOR_X(0, 0, 0, 0.5);
        centerView.frame = CGRectMake((kScreen_Width-110)/2.0, (self.height-90)/2.0, 110, 90);
        [bg addSubview:centerView];
        
        UILabel *titleLabel = [[UILabel alloc] init];
        titleLabel.frame = CGRectMake(0, 12, centerView.width, 30);
        titleLabel.text = goodsName;
        titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:24];
        titleLabel.textColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1];
        titleLabel.textAlignment = NSTextAlignmentCenter;
        [centerView addSubview:titleLabel];
        
        UILabel *subTitle = [[UILabel alloc] init];
        subTitle.frame = CGRectMake(0, titleLabel.bottom+8, centerView.width, 24);
        subTitle.text = subtitle;
        subTitle.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:19.2];
        subTitle.textColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1];
        subTitle.textAlignment = NSTextAlignmentCenter;
        [centerView addSubview:subTitle];
        
        
//        UIView *lineView1 = [[UIView alloc] init];
//        lineView1.frame = CGRectMake(centerView.x, centerView.y, 25, 1);
//        lineView1.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1];
//        [bg addSubview:lineView1];
//
//        UIView *lineView2 = [[UIView alloc] init];
//        lineView2.frame = CGRectMake(centerView.x, centerView.y, 1, 25);
//        lineView2.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1];
//        [bg addSubview:lineView2];
//
//        UIView *lineView3 = [[UIView alloc] init];
//        lineView3.frame = CGRectMake(centerView.width-25, centerView.height-1, 25, 1);
//        lineView3.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1];
//        [centerView addSubview:lineView3];
//
//        UIView *lineView4 = [[UIView alloc] init];
//        lineView4.frame = CGRectMake(centerView.width-1, centerView.height-25, 1, 25);
//        lineView4.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1];
//        [centerView addSubview:lineView4];
        
    }
    
    return self;
}

@end
